package com.example.system.domain.question.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.time.LocalDateTime;

@Data
@Document(indexName = "idx_question")
public class QuestionESVO {

    @Schema(description = "题目id")
    @Id
    @Field(type = FieldType.Keyword)
    private Long questionId;

    @Schema(description = "题目标题")
    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String title;

    @Schema(description = "题目内容")
    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String content;

    @Schema(description = "默认代码块")
    @Field(type = FieldType.Text)
    private String defaultCode;

    @Schema(description = "main函数")
    @Field(type = FieldType.Text)
    private String mainFunc;

    @Schema(description = "题目用例")
    @Field(type = FieldType.Text)
    private String questionCase;

    @Schema(description = "时间限制")
    @Field(type = FieldType.Long)
    private Long timeLimit;

    @Schema(description = "空间限制")
    @Field(type = FieldType.Long)
    private Long spaceLimit;

    @Schema(description = "题目难度")
    @Field(type = FieldType.Byte)
    private Integer difficulty;

    @Schema(description = "题目创建时间")
    @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second)
    private LocalDateTime createTime;
}
